import request from '@/utils/request'
//注册接口
export const userRegisterService = (registerData) => {

    const params = new URLSearchParams()
    for (let key in registerData) {
        params.append(key, registerData[key])
    }
    return request.post('/user/register', params)
}
//登录接口
export const userLoginService = (loginData) => {
    const params = new URLSearchParams()
    for (let key in loginData) {
        params.append(key, loginData[key])
    }

    return request.post('/user/login', params)
}

//获取用户信息接口
export const userInfoService = () => {
    return request.get('/user/userInfo')
}

// 修改用户信息接口
export const userInfoUpdateService = (userInfoData) => {
    return request.put('/user/update', userInfoData)
}

//修改头像接口
export const userAvatarUpdateService = (avatarUrl) => {
    return request.patch('/user/updateAvatar?avatarUrl=' + avatarUrl)
}

//修改密码接口
export const userPwdUpdateService = (userPwd) => {
    console.log(userPwd);
    return request.patch('/user/updatePwd', userPwd)
}
